#ifndef GFAUX_TOOLS_H
#define GFAUX_TOOLS_H
#include <vector>
#include <string>
#include <cstdio>
#include <istream>
#include <string>
#include "raii_dll.h"
#include "image_matrix_types.h"
#include "FaceApi_typedef.h"
#ifndef GAX_API
#  if defined(_WIN32) && !defined(__CYGWIN__) && !defined(GFAUX_STATIC)
#    ifdef GFAUX_EXPORTS
#      define GAX_API  __declspec(dllexport)
#    else
#      define GAX_API  __declspec(dllimport)
#    endif
#  else
#    define GAX_API
#  endif
#endif
namespace gdface {
	template class GAX_API raii_dll<std::string>;
	namespace ui {
		GAX_API void showText(const std::vector<net::gdface::sdk::CodeInfo>& codes,
			const std::string& title_prefix="");
		GAX_API void showImage(const std::vector<net::gdface::sdk::CodeInfo>& codes,
			const std::string& imgData, 
			const std::string& title_prefix = "");
		GAX_API void showImage2In1(const std::string & leftimgData, 
			const std::string & rightimgData, 
			double similarity, 
			const std::string & title_prefix="", 
			const net::gdface::sdk::FRect * leftrect = nullptr,
			const net::gdface::sdk::FRect * rightrect=nullptr);
	} /* namespace folder */
	namespace image {
#ifdef GFAUX_STATIC
		void get_image_binary(const std::string&filename,std::string&out);
		void get_image_binary(std::FILE *file,std::string&out);
		void get_image_binary(std::istream&stream, std::string&out);
		void get_image_binary(const char *filename,std::string&out);
		// 将图像矩阵压缩为jpeg格式数据流
		void get_image_binary(const fs_image_matrix&matrix,std::string&out);
#endif /* GFAUX_STATIC */
		// 设置 jpeg 压缩质量默认值(全局) 0~100(默认100）
		GAX_API void set_default_jpeg_quality(uint32_t quality);
		// 设置 jpeg 压缩质量默认值(当前线程) 0~100(默认100）
		GAX_API void set_jpeg_quality(uint32_t quality);

		typedef class raii_dll<std::string> raii_string;
		GAX_API raii_string get_image_binary_raii(const std::string&filename);
		GAX_API raii_string get_image_binary_raii(std::istream&stream);
		GAX_API raii_string get_image_binary_raii(const char *filename);
		GAX_API raii_string get_image_binary_raii(const fs_image_matrix&matrix);
		/* 对jpeg格式的图像解码，返回解压后的图像矩阵 */
		GAX_API fs_image_matrix decompress_jpeg_mem(const void* jpg,size_t size);
		/* 对jpepg2000(jp2)格式的图像解码，返回解压后的图像矩阵 */
		GAX_API fs_image_matrix decompress_jp2_mem(const void* jp2, size_t size);
	} /* namespace image */
} /* namespace gdface */
#endif // !GFAUX_TOOLS_H

